<template>
	<!-- 营业额明细 -->
	<view class="t_wp">
		<view class="t_title">营业额：<text>{{info.total}}</text></view>
		<view class="t_title1">
			<text>现金： <text class="money">{{info.credit2}}</text> </text>
			<text style="margin-left: 20upx;">米券：<text class="money">{{info.credit1}}</text></text>
		</view>
		<view class="t_list">
			<view class="t_item" v-for="item in orderList" :key="item.ordersn">
				<view class="t_li">
					<text class="t_order">订单号：{{item.ordersn}}</text>
					<text class="t_money">价格：{{item.price}}</text>
				</view>
				<view class="t_li">
					<text>下单时间：{{item.createtime}}</text>
					<text class="t_status">{{item.status}}</text>
				</view>
			</view>
		</view>
		<view class="loading_empty">
			<image v-if="isloading" src="/static/business/loading.gif" ></image>
			<text v-if="isempty">到底了~</text>
		</view>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				
				info:{total:'0.00',credit1:0,credit2:0},
				orderList:[],
				month:'',
				begin:'',
				end:'',
				page:0,
				
				isempty:false,
				isloading:false,
			}
		},
		onLoad(option) {
			this.month=option.month?option.month:this.month;
			this.begin=option.begin?option.begin:this.begin;
			this.end=option.end?option.end:this.end;
			this.getinfo();
		},
		onReachBottom() {
			this.getinfo();
		},
		onBackPress() {
			uni.switchTab({
				url: '/pages/individualism/user'
			});
			return true;
		},
		methods:{
			getinfo(){
				this.page++;
				this.isloading=true;
				let obj={
					month:this.month,
					begin:this.begin,
					end:this.end,
					page:this.page,
				}
				this.$axios('order/sale','POST','supplier',obj).then(res=>{
					this.isloading=false;
					if(res.data.code==200){
						this.info=res.data.data;
						let length=res.data.data.orderList.length;
						this.orderList=this.orderList.concat(res.data.data.orderList);
						this.isempty=length<=0?true:false;
					}
				})
			}
		},
		onNavigationBarButtonTap(e) {
			if(e.type=="shaixuan"){
				this.$navTo('../business/screen');
			}
		}
	}
</script>

<style lang="scss">
	page{
		background-color: #f2f2f2;
	}
	.t_wp{
		color: $font-color-dark;
		padding-bottom: 100upx;
	}
	.t_title,.t_title1{
		display: flex;
		align-items: center;
		justify-content: center;
		padding: 20upx 0;
		font-size: 30upx;
	}
	.t_title text,.t_title1 .money{
		color: $base-color;
		font-weight: bold;
		font-size: 32upx;
	}
	.t_title1{
		padding-top: 0;
	}
	.t_item{
		background: #fff;
		border-radius: 10upx;
		margin-bottom: 20upx;
		padding: 20upx;
	}
	.t_li{
		display: flex;
		align-items: center;
		justify-content: space-between;
		line-height: 40upx;
	}
	.t_order{
		color: $font-color-light;
	}
	.t_money{
		color: $font-color-spec;
	}
	.t_status{
		color: $base-color;
	}
	.loading_empty{
		color: #0062CC;
		text-align: center;
		padding: 20upx;
	}
	.loading_empty image{
		height: 50upx;
		width: 50upx;
	}
</style>
